package com.up.upzl.biz.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 通用
 * 
 * @author geeks
 *
 */
@RestController
public class SystemApi {

	@Autowired
	private Environment env;

	/**
	 * 用于检测服务是否正常启动
	 */
	@GetMapping("heartbeat")
	public @ResponseBody String heartbeat() {
		return env.getActiveProfiles()[0];
	}

	/**
	 * 用于检测服务是否正常启动
	 */
	@GetMapping("challenge")
	public @ResponseBody String challenge() {
		return "envs.push('api-" + env.getActiveProfiles()[0] + "');";
	}
}
